﻿-- =============================================
-- Author:		Rui Miguel Santos
-- Create date: 2011-11-16
-- Description:	Retorna a data da segunda-feira da semana actual
-- =============================================
CREATE FUNCTION ObterSegundaFeiraSemanaActual 
(
	-- Add the parameters for the function here
	@data DateTime
)
RETURNS DateTime
AS
BEGIN
	-- Declare the return variable here
	DECLARE @Result DateTime

	SELECT @Result = DATEADD(wk, DATEDIFF(wk,0,@data), 0) 

	-- Return the result of the function
	RETURN @Result

END
